home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 51 / Amiga Format CD51 (2000-03-10)(Future Publishing)(GB)[!][issue 2000-04].iso / -in_the_mag- / pdselect / awnp / awnp-docs / guidesign.doc < prev    next >
Text File  |  2000-02-16  |  2KB  |  76 lines

  1.  Working through these tutorials in order is the best way to learn to build GUI's with AWNPipe. A few minutes here will save you hours of development time later.
  2.  
  3.  TUTORIAL 1
  4. -----------
  5.  
  6. Building GUIs ca be VERY easy, This first tutorial will develop a simple GUI.
  7.  
  8.  Create a simple 4 line text file called first.gui . (you can dragselect and the Right Amiga C to copy text from these docs)
  9.  
  10. title "My first GUI" defaultgadgets
  11. button gadgettext "YES"
  12. button gt "NO"
  13. open
  14.  
  15. Now in a shell 'copy first.gui awnpipe:/xc'.
  16.  
  17. That was easy. You already guessed that gt was a short form for gadgettext.
  18.  
  19. Now we want to see what events the GUI sends. We can direct the events to a con by adding 'wcon:' to the end of the pipe name. Try
  20.  
  21. 'copy first.gui awnpipe:/xcwcon:'
  22.  
  23. Notice that the pipe replies to each line of the definition file as well as sending events.
  24.  
  25.  Now add a little text to the gui. We will also provide keyboard shortcuts for the gadgets.
  26.  
  27. title "My first GUI" defaultgadgets
  28. label  gt " Select YES or NO "
  29. button gadgettext "_YES"
  30. button gadgettext "_NO"
  31. open
  32.  
  33.  That worked, but it looks a little UGLY. Lets try a vertical layout instead of horizontal (the default).
  34.  
  35. title "My first GUI" defaultgadgets  vertical
  36. label  gt " Select YES or NO "
  37. button gadgettext "_YES"
  38. button gadgettext "_NO"
  39. open
  40.  
  41.  Getting better but we really want the two gadgets side by side. To do that we will use a layout group. (le is layout end).
  42.  
  43. title "My first GUI" defaultgadgets  vertical
  44. label  gt " Select YES or NO "
  45. layout
  46. button gadgettext "_YES"
  47. button gadgettext "_NO"
  48. le
  49. open
  50.  
  51.  That is much better! Looks good but it would be nicer if the window closed after the user selected yes or no. ( you also notice that the layout received a GID number so yes and no are now gadget 2 and 3)
  52.  
  53. title "My first GUI" defaultgadgets  vertical
  54. label  gt " Select YES or NO "
  55. layout
  56. button gadgettext "_YES" close
  57. button gadgettext "_NO" c
  58. le
  59. open
  60.  
  61.  Its done, it might even be useful.
  62.  
  63.  Since we have a working gui lets use it to see a few other types of events the GUI can generate.
  64.  
  65. title "My first GUI" defaultgadgets  vertical  sendkeys sendqual help state
  66. label  gt " Select YES or NO "
  67. layout
  68. button gadgettext "_YES" close
  69. button gadgettext "_NO" c
  70. le
  71. open
  72.  
  73.  Activate and inactivate the window. Hold the mouse over each gadget. Type a few keys. Try the shift, alt ect.
  74.  
  75.  
  76.